\documentclass[12pt,table]{book} % Tamaño de letra 12 tipo libro

\usepackage[spanish]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=8in, paperheight=10in, margin = 0.8in]{geometry}%Crea un documento de 
%tamaño 8x10

\usepackage{indentfirst}
\usepackage{eurosym} 
\usepackage{mdframed}
\usepackage{soul}
\usepackage{ulem}
\usepackage{verbatim}
\usepackage{float}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{ulem}
\usepackage{fancybox}
\usepackage{framed,color}
\usepackage{listings}
\usepackage{pifont}
\usepackage{amsmath}%Estructuras que contienen las formulas matemáticas
\usepackage{amssymb}%Coleccion de simbolos
\usepackage{amsfonts}%Otra coleccion de simbolos
\usepackage{amsthm}%Teoremas
\usepackage{enumerate}
\usepackage[most]{tcolorbox}
\usepackage[super]{nth}
\usepackage[Bjornstrup]{fncychap}
\usepackage[usenames,dvipsnames]{color}
% Fin fuentes----------------------------------------------------------
\usepackage{listings}
\definecolor{keywords}{HTML}{8A4A0B}
\definecolor{background}{HTML}{EEEEEE}
\definecolor{comments}{RGB}{128,0,0}
\definecolor{myblue}{RGB}{0,51,204}
\definecolor{halfgray}{gray}{0.55}
\definecolor{rojo}{RGB}{230,0,0}
\usepackage[scaled=.95]{inconsolata}
\tcbuselibrary{listings, breakable, skins}
\definecolor{bg}{rgb}{0.85,0.85,0.85}
%\newtcblisting{ccode}[2][]

\lstset{language=[LaTeX]Tex,
    keywordstyle=\color{rojo},
    texcsstyle=*\color{myblue},
    basicstyle=\textbf\normalfont\ttfamily,
    commentstyle=\color{comments}\ttfamily,
    stringstyle=\rmfamily,
    numbers=left,
    numberstyle=\scriptsize,
    stepnumber=1,
    numbersep=8pt,
    captionpos=top,
    showstringspaces=false,
    breaklines=true,
    frameround=ftff,
    morekeywords={RequirePackage,ProvidesPackage,NeedsTeXFormat},
    backgroundcolor=\color{background},
    literate=
            *{\{}{{\textcolor{myblue}{\{}}}{1}
            {\}}{{\textcolor{myblue}{\}}}}{1}
            {\\}{{\textcolor{myblue}{\textbackslash}}}{1}
            {\$}{{\textcolor{rojo}{\$}}}{1}
            {\&}{{\textcolor{rojo}{\&}}}{1}
            {documentclass}{{\textcolor{rojo}{\textbackslash documentclass}}}{12}
            {\%\\documentclass}{{\textcolor{rojo}{\textbackslash documentclass}}}{12}
            {\%\\usepackage}{{\textcolor{rojo}{\textbackslash usepackage}}}{9}
            {[}{{\textcolor{myblue}{[}}}{1}
            {]}{{\textcolor{myblue}{]}}}{1}
            {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {ñ}{{\~n}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1,
    frame=single,
    frameround={t}{t}{t}{t},
    framexleftmargin=6mm,
    numbers=left,
    numberstyle=\tiny\color{halfgray},
}
\lstset{emph={%  
    maketitle, date, title, author, date, chapter, section, subsection, usepackage, signature, address, opening, closing, ps, encl, newline, clearpage, newpage, centering, includegraphics, textwidth, caption, textit, emph, sout, uuline, uwave, xout, normalsize, tiny, scriptsize, footnotesize, small, large, Large, LARGE, huge, Huge, textsc, texttt, textbf, underline, subfigure, hspace, hline, cline, multirow, multicolumn, item, labelitemi, renewcommand, labelitemiii, labelitemiv, ding, cdot, labelitemii, noindent, setlength, columnseprule, useunder, uline, ul, def, columnseprulecolor, mbox, makebox, fbox, fboxrule, fboxsep, framebox, shadowbox, doublebox, ovalbox, color, xcolor, textcolor, colorbox, definecolor, fcolorbox, pagecolor, rowcolor, columncolor, spanishdatedel, tableofcontents, cellcolor, sum, infty, limits, nolimits, dfrac, frac, left, right, Big, sqrt, int, iint, iiint, displaystyle, oint, quad, text, overbrace, underbrace, rightarrow, cdots, pi, lim, sin, cos, geq, leq, fd, lbrace, par, columnbreak
    },emphstyle={\textcolor{myblue}},
    emph={[2]begin, end}, emphstyle=[2]\textcolor{rojo}
}



\newcommand{\wlatex}{\lstinline}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Si da error el color, ignorar (incompatible con fancy)
\usepackage[table,xcdraw]{xcolor}
\definecolor{gf}{rgb}{0.9,0.9,0.9}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[fencedCode,inlineFootnotes,citations,definitionLists,hashEnumerators,smartEllipses,hybrid,html]{markdown}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{calc}
\newlength{\pageoffset}
\setlength{\pageoffset}{0.5cm}% 
\fancyheadoffset[LE,RO]{\pageoffset}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[RO]{\bfseries\rightmark\makebox[\pageoffset][r]{\bfseries\thepage\hspace{-1cm}}\phantom{2345f}}
\fancyhead[LE]{\makebox[\pageoffset][l]{\bfseries\thepage}\bfseries\leftmark}
\fancypagestyle{plain}{
    \fancyhead{} 
    \renewcommand{\headrulewidth}{0pt} 
}

\usepackage{emptypage} % Manda a pastar las cabeceras de las páginas vacias
\usepackage{afterpage} % para newpage y generación de paginas nulas
\setlength{\parindent}{8mm} % Sangría de inicio de párrafo de 8mm
\renewcommand{\chaptername}{Capítulo} % Renombrar chapter to capítulo
\renewcommand{\lstlistingname}{Código}% Listing -> código
\renewcommand*{\lstlistlistingname}{Lista de \lstlistingname s}
% Cabeceras

\newcommand{\basix}{${\displaystyle  {\textrm{B}\!^{{}_{\scriptstyle \textrm{\textsc{\large A}}}}\!\!\!\!\;\;\textrm{S}_{\displaystyle \textrm{I}}\!\textrm{X}\!\!^{{}_{\scriptstyle}}}}$}

\newcommand{\medex}{${\displaystyle  {\textrm{M}\!^{{}_{\scriptstyle \textrm{\textsc{\large E}}}}\!\!\!\!\;\;\textrm{D}_{\displaystyle \textrm{E}}\!\textrm{X}\!\!^{{}_{\scriptstyle}}}}$}

\newcommand{\advisor}{${\displaystyle  {\textrm{AD}\!^{{}_{\scriptstyle \textrm{\textsc{\large V}}}}\!\!\!\!\;\;\textrm{I}_{\displaystyle \textrm{S}}\!\textrm{OR}\!^{{}_{\scriptstyle}}}}$}

\newcommand{\slidex}{${\displaystyle  {\textrm{S}\!^{{}_{\scriptstyle \textrm{\textsc{\large }}}}\!\!\!\!\;\;\;\textrm{LI}_{\displaystyle \textrm{D}}\!\textrm{EX}\!^{{}_{\scriptstyle}}}}$}

\newcommand{\teflon}{{${\displaystyle {\textrm{T}\!^{{}_{\scriptstyle \textrm{E}}}\!\!\!\!\;\;\textrm{F}\!_{\displaystyle \textrm{L}}\!\textrm{O}\!^{{}_{\scriptstyle \textrm{N}}}}}$}}

\newcommand{\bookes}{{${\displaystyle  {\textrm{B}\!^{{}_{\scriptstyle \textrm{O}}}\!\!\!\!\;\;\textrm{O}\!_{\displaystyle \textrm{K}}\!\textrm{E}\!^{{}_{\scriptstyle \textrm{S}}}}}$}}

\begin{document}

\pagenumbering{Roman}
\include{bookes} % Se usa un .tex con estilos para tenerlos ordenados Se podría realizar un .cls pero luego mucha gente tiene problemas para importarlos
\input{Contents/title.tex}
\include{Contents/Foreword}
\include{Contents/Dedic}
\include{Contents/aboutlvl}
% Indice de contenidos
\include{Contents/Index}
%Prólogo
\include{Contents/Prolog}
\fancyhead[LE]{\makebox[\pageoffset][l]{\bfseries\thepage}\bfseries\hspace{1cm}\leftmark}
% Capítulos
\pagenumbering{arabic}
\include{Chapters/Chapter01}
\include{Chapters/Chapter02}
\include{Chapters/Chapter03}
\include{Chapters/Chapter04}
\include{Chapters/Chapter05}
\include{Chapters/Chapter06}
\listoffigures
\listoftables
\lstlistoflistings
\end{document}
